%summary
In this paper, we presented a catalog of bad smells that recur in DBC development with JML. Bad smells are not bugs, but might bring problems in readability and extensibility of contracts, offering opportunities for refactoring. The paper's focus is not refactoring, although we suggest actions for removing bad smells as part of their description.

%evaluations
The main source of bad smells in DBC was a number of graduate student projects that involved writing contracts at several development stages. In order to evaluate the recurrence of these smells in more robust projects, we manually analyzed several classes from the JML models API. Currently, most well-designed DBC applications with JML employ classes from this API in contracts, showing its substantial importance. The most recurrent smells were detected in the analyzed classes, showing that they can happen in real development contexts.


%good dbc code
From the catalogued smells, we can conclude that good DBC contracts are succint and abstract. For effective DBC development, contracts must be source of readable information for implementers and clients. Most importantly, they should not threaten encapsulation in the specified program. Otherwise, good programming practices can be made useless if the associated contracts expose internal data. Also, contract size is often an important alarm for the need of simplification, as showed in the results of our evaluation.

%include discussion about model fields and query methods in assignable clauses


%future steps
This catalog of DBC smells is the first step towards the definition of techniques for refactoring programs with contracts. Based on previous results from our research group~\cite{setra06,massoniEtAl2008} in synchronizing model and program refactorings, our future work is to investigate how refactored contracts affect programs (and vice-versa). The work with bad smells will point out targets for refactoring in the context of DBC.

%other JML constructs - refinement, behavioral subtyping
Regarding extensions of the bad smells catalog, further steps will consider more advanced JML constructs (such as refinement), in addition to issues related to behavioral subtyping. Moreover, we intend to build a tool support to automatically detect the smells, and use it to analyze other classes of the JML API.

